import java.io.*;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
public class ReadXML
{
	private InputProject ratProject = null;
	private final String XML_FILE="input.xml";
	
	public ReadXML()
	{
		XStream xStream = new XStream(new DomDriver());
		try 
		{
			xStream.alias("project", InputProject.class);
			ratProject = (InputProject)xStream.fromXML(new FileInputStream(XML_FILE));
		}
		catch (FileNotFoundException e) 
		{
			e.printStackTrace();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}

	public String readTag(String tagName)
	{
		try
		{
			Thread.sleep(800);
		if(tagName.equalsIgnoreCase("name"))
		{
			return ratProject.getName();
		}
		else if(tagName.equalsIgnoreCase("startdate"))
		{
			return ratProject.getStartdate().toString();
		}
		else if(tagName.equalsIgnoreCase("description"))
		{
			return ratProject.getDescription();
		}
		else if(tagName.equalsIgnoreCase("versionidentifier"))
		{
			return(ratProject.getVersionidentifier()+"");
		}
		else if(tagName.equalsIgnoreCase("releasedate"))
		{
			return ratProject.getReleasedate().toString();
		}
		else if(tagName.equalsIgnoreCase("inputjarfile"))
		{
			return ratProject.getInputjarfile();
		}
		else if(tagName.equalsIgnoreCase("enteranotherfile"))
		{
			return ratProject.getEnteranotherfile();
		}
		else if(tagName.equalsIgnoreCase("enteranotherversion"))
		{
			return ratProject.getEnteranotherversion();
		}
		else if(tagName.equalsIgnoreCase("userelative"))
		{
			return ratProject.getUserelative();
		}
		else if(tagName.equalsIgnoreCase("generatechart"))
		{
			return ratProject.getGeneratechart();
		}
		else if(tagName.equalsIgnoreCase("bincount"))
		{
			return(ratProject.getBincount()+"");
		}
		else if(tagName.equalsIgnoreCase("minimumbincount"))
		{
			return(ratProject.getMinimumbincount()+"");
		}
		else if(tagName.equalsIgnoreCase("maximumbincount"))
		{
			return(ratProject.getMaximumbincount()+"");
		}
		return null;
	}
	catch(InterruptedException e){
		return null;}
	}
}